import http from '@/utils/http.js';
const home = {
	/*
	 * 方法说明: 示例请求方法
	 * author: gaomingzhe
	 * description: 
	 * @param {}   
	 * @return 
	 * @createTime: 2021-12-5 2:52:38 ?F10: PM?
	 */
	async getPageList({commit}, data={index:0}){
		let tabType = [
			{val:0,url:'/api/car/get_page_list'},
			{val:1,url:'/api/card/get_list'},
			{val:2,url:'/api/setmeal/get_list'},
			{val:3,url:'/api/shop/get_list'},
		]
		let url = tabType[data.index].url || '/api/car/get_page_list'
		let params = data
		const res = await uni.$request(url,params)
		console.log(res)
		if(res.errno!=0) uni.$toast('请求失败！')
		return res.data
	},
	async getNoticeCnt({commit}, data){
		let params = data
		const res = await uni.$request('/api/index/get_notice_cnt', params)
		console.log(res.data.notice_cnt>0)
		if(res.errno!=0) uni.$toast('请求失败！')
		return res.data.notice_cnt>0
	},
	async getList({commit}, data){
		let params = data
		const res = await uni.$postRequest('/api/city/get_list', params)
		console.log(res)
		if(res.errno!=0) uni.$toast('请求失败！')
		return res.data.info_list
	},
	async getHomeMsg({commit}, data){
		let params = data
		const res = await uni.$postRequest('/api/index/get_home_msg', params)
		console.log(res)
		if(res.errno!=0) uni.$toast('请求失败！')
		return res.data
	}
};

export default home;
